<template>
    <div class="mood-container flex flex-column">
        <div class="mood-title flex align-center">
            <div :class="['tab', { 'active': tabIndex === index }]" v-for="(item, index) in tabs" :key="index"
                @click="changeTab(index)">{{
                    item.name }}
            </div>
        </div>
        <!-- 话术呼应 -->
        <div class="mood-content flex flex-column" v-if="tabIndex === 0">
            <div class="title flex align-center">
                <div class="left">话术呼应</div>
                <span>(主播智能话术呼应功能)</span>
            </div>
            <div class="form-box">
                <el-form>
                    <el-form-item label="打断设置">
                        <el-radio-group v-model="echoFrom.radio1">
                            <el-radio :value="1">随机模式</el-radio>
                            <el-radio :value="2">打断主播话术</el-radio>
                            <el-radio :value="3">不打断主播话术</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item label="呼应配置">
                        <el-collapse v-model="activeNames" style="margin-bottom:10px">
                            <el-collapse-item v-for="(item, index) in collapeses" :title="item.title" :name="item.name"
                                :key="item.id">
                                <el-form :model="item.configForm" class="children-form" style="padding:0 10px">
                                    <el-form-item label="当主播话术中说到">
                                        <el-input size="small" v-model="item.configForm.comment"></el-input>
                                    </el-form-item>
                                    <el-form-item label="助播呼应">
                                        <el-input size="small" v-model="item.configForm.voiceResponse"></el-input>
                                    </el-form-item>
                                </el-form>
                            </el-collapse-item>
                        </el-collapse>
                    </el-form-item>
                    <el-row style="margin-top:20px">
                            <el-button type="primary" size="small" @click="addCollapes">新增内容</el-button>
                        </el-row>
                </el-form>
            </div>
        </div>
        
        <!-- 智能评论 -->
        <div class="mood-content flex flex-column" v-if="tabIndex === 1">
            <div class="title flex align-center">
                <div class="left">智能评论</div>
                <el-switch v-model="mindCommentForm.switchStatus"></el-switch>
            </div>
            <div class="form-box">
                <div class="form-item flex align-center">
                    <span class="label">每次评论间隔</span>
                    <el-input-number size="small" :controls="false"></el-input-number>
                    <span class="label">至</span>
                    <el-input-number size="small" :controls="false"></el-input-number>
                    <span class="label">秒，发送</span>
                    <el-input-number size="small" :controls="false"></el-input-number>
                    <span class="label">至</span>
                    <el-input-number size="small" :controls="false"></el-input-number>
                    <span class="label">条公屏消息</span>
                </div>
                <div class="form-item">
                    <div class="label mt">智能评论话术</div>
                    <EditScriptCom></EditScriptCom>
                </div>
            </div>
        </div>
        <div class="mood-btn flex justify-end">
            <el-button type="primary" size="small">保存数据</el-button>
        </div>
    </div>
</template>

<script setup>
import { reactive, ref } from 'vue'
import EditScriptCom from '@/components/EditScriptCom/index.vue'

const tabIndex = ref(0)
const tabs = ref([
    {
        name: '话术呼应'
    },
    {
        name: '智能评论'
    },
])

const activeNames = ref(['1'])
const collapeses = ref([
    {
        title: "呼应配置",
        name: "1",
        configForm: {
            commentContent: "",
            voiceResponse: "",
        },
    },
]);

const echoFrom = reactive({
    radio1:1
})

const mindCommentForm = reactive({
    switchStatus: true
})

const changeTab = (i) => {
    tabIndex.value = i
}
</script>

<style lang="less" scoped>
.mood-container {
    height: 100%;

    .mood-title {
        width: 100%;
        height: 35px;
        background-color: @bg-default;
        box-sizing: border-box;
        padding-left: 20px;
        margin-bottom: 20px;
        flex-shrink: 0;

        .tab {
            margin-right: 40px;
            color: @font-color-default;
            cursor: pointer;

            &.active {
                color: @color-white;
            }
        }
    }

    .mood-content {
        height: 100%;
        padding: 20px;
        background-color: @bg-default;

        .title {
            color: @color-white;
            // margin-bottom: 20px;

            .left {
                position: relative;
                padding: 10px;

                &::before {
                    content: "";
                    display: block;
                    position: absolute;
                    left: 0;
                    bottom: 0;
                    top: 0;
                    margin: auto;
                    width: 4px;
                    height: 16px;
                    background-color: #1f6edf;
                }
            }
        }

        .form-box {
            .form-item {
                margin-bottom: 10px;

                .label {
                    color: @color-white;
                    margin: 0 10px;
                    font-size: 12px;

                    &.mt{
                        margin-bottom: 20px;
                    }
                }


                .right-content {
                    .input-box {
                        margin-bottom: 10px;

                        .input-cell {
                            margin-bottom: 10px;

                            :deep(.el-icon) {
                                color: @color-white;
                                cursor: pointer;
                            }
                        }
                    }

                }
            }

            .tips {
                font-size: 12px;
                color: @font-color-default;
                margin-left: 20px;
            }

            :deep(.el-form-item__content) {
                display: block;
            }

            :deep(.el-radio__label) {
                color: @color-white;
            }


            :deep(.el-form-item__label) {
                color: @color-white!important;
            }

            .children-form{
                :deep(.el-form-item__label) {
                    color: #000!important;
                }
            }
        }
    }

    .mood-btn{
        box-sizing: border-box;
        padding-right:20px;
        padding-bottom: 20px;
        background-color: @bg-default;
    }
}
</style>